﻿// <copyright file="ITaskProvider.cs">
// Copyright (c) Chad Weimer
// </copyright>
// <author>Chad Weimer</author>
// <summary>
// This file is part of Tasx.
//
// Tasx is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tasx is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Tasx.  If not, see http://www.gnu.org/licenses/.
// </summary>

using System;
using System.Collections.Generic;

namespace Tasx.Definitions
{
    //public interface ITaskProvider
    //{
    //    /// <summary>
    //    /// Gets the name of the provider.
    //    /// </summary>
    //    string Name { get; }
		
    //    /// <summary>
    //    /// Gets 
    //    /// </summary>
    //    IEnumerable<ITaskList> Lists { get; }
		
    //    void Sync();
    //    ITaskList CreateList();
    //    ITaskList CreateList(string name);
    //    void AddList(ITaskList list);
    //    ITask CreateTask();
    //    ITask CreateTask(string summary);
    //    void AddTask(ITask task, ITaskList list);
    //    void AddTask(ITask task, ITask parent);
    //}
	
	public interface ITaskProviderData
	{
		string Name { get; }
	}
	
	public enum TaskPriority
	{
		Low,
		Medium,
		High,
		Critial,
	}

    // NEW

    public interface ITaskProvider
    {
        /// <summary>
        /// Gets the name of the provider.
        /// </summary>
        string Name { get; }

        TasksProxy Sync(TasksProxy proxy);
    }

    public sealed class TasksProxy
    {
        public IList<Task2> Tasks { get; set; }
        public IList<TaskList2> Lists { get; set; }
    }

    public sealed class Task2 : ITaskItem
    {
        /// <summary>
        /// Gets or sets the summary of the task.
        /// </summary>
        public string Summary { get; set; }
        string ITaskItem.Name { get { return Summary; } set { Summary = value; } }

        /// <summary>
        /// Gets or sets additional notes on the task.
        /// </summary>
        public string Notes { get; set; }

        /// <summary>
        /// Gets or sets the due date of the task, if any.
        /// </summary>
        public DateTime? DueDate { get; set; }

        /// <summary>
        /// Gets or sets when the reminder, if any, should occur relative to the due date.
        /// </summary>
        public TimeSpan? Reminder { get; set; }

        /// <summary>
        /// Gets or sets the <see cref="TaskPriority"/> of the task.
        /// </summary>
        public TaskPriority Priority { get; set; }

        /// <summary>
        /// Gets or sets whether the task has been completed.
        /// </summary>
        public bool Completed { get; set; }

        /// <summary>
        /// Gets or sets the parent of this instance (either a <see cref="TaskList2"/> or another <see cref="Task2"/>.
        /// </summary>
        public ITaskItem Parent { get; set; }

        /// <summary>
        /// Gets or sets an object to store additional context.
        /// </summary>
        public object Context { get; set; }
    }

    public sealed class TaskList2 : ITaskItem
    {
        /// <summary>
        /// Gets or sets the name of the list.
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets a description of the list.
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// Gets or sets an object to store additional context.
        /// </summary>
        public object Context { get; set; }
    }

    public interface ITaskItem
    {
        /// <summary>
        /// Gets or sets the name of the item.
        /// </summary>
        string Name { get; set; }

        /// <summary>
        /// Gets or sets an object to store additional context.
        /// </summary>
        object Context { get; set; }
    }
}